/*
 * InputManager.h
 */
 
#ifndef INPUTMANAGER_H_
#define INPUTMANAGER_H_

#ifndef NULL
#define NULL 0
#endif

#include "../domain/Map.h"
#include "../domain/Utils.h"
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "../business/Logger.h"
using std::string;
using std::ifstream;

const char DEFAULT_DELIMITER = ';';
const char DEFAULT_ADDRESS_RANGE_SEPARATOR = '-';

/**
 * Input Manager class. Holds every functionality that has to do with input data.
 * Creates the Graph, vertex and edges from the input file.
 */
class InputManager {
private:
	ifstream* streamV;
	ifstream* streamE;
	ifstream* streamM;
	Map* map;

	/**
	 * Process the input file (vertices.txt) creating the different Vertex and adding them to the graph.
	 */
	void processVertexStructure ();

	/**
	 * Process the input file (aristas.txt) creating the different Edges and adding them to the graph.
	 */
	void processEdgeStructure ();

	/**
	 * Process the input file (objetosDeMapa.txt) creating the different MapObjects and informing errors at the log.
	 */
	void processMapObjectStructure ();

public:
	/**
	 * Defaults constructor & destructor
	 */
	InputManager(ifstream* streamV, ifstream* streamE, ifstream* streamM);
	virtual ~InputManager() {};

	/**
	 * Process the input files and returns a Map which includes a well formed graph and the map objects
	 */
	Map* createMap();
};

#endif /*INPUTMANAGER_H_*/
